<script setup lang="ts">
import useInfoStore from "@/store/modules/info";
// 获取useInfoStore对象
let infoStore = useInfoStore();
console.log(infoStore);
const handler = () => {
  // infoStore.count+=1
  // infoStore.$patch({
  //   count:111
  // })
  // 定义自定义方法
  // 仓库调用自生方法修该数据
  infoStore.updateNum(2, 3);
};
const addNum = () => {
  infoStore.addAttr(2)
};
</script>

<template>
  <div class="child">
    <h2>子组件</h2>
    {{ infoStore.count }}--->{{ infoStore.total }}
    <hr />
    <el-button @click="handler">点击我修改数据</el-button>
    <el-button @click="addNum">增加数据</el-button>
  </div>
</template>

<style scoped>
.child {
  width: 400px;
  height: 400px;
  background: skyblue;
}
</style>